home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _EBE83D6116694B3E927FE6E8F7AD3BB6 < prev    next >
Encoding:
Text File  |  2004-01-06  |  5.0 KB  |  144 lines

  1. --------------------------------------------------
  2. --    Created By: Petar
  3.  
  4.  
  5. AIBehaviour.ChimpIdle = {
  6.     Name = "ChimpIdle",
  7.  
  8.  
  9.     OnNoTarget = function( self, entity )
  10.         self:ANY_MORE_TO_RELEASE(entity);
  11.     end,
  12.     ---------------------------------------------
  13.     ---------------------------------------------
  14.     OnPlayerSeen = function( self, entity, fDistance )
  15.         -- called when the enemy sees a living player
  16.  
  17.  
  18.         entity:SelectPipe(0,"abberation_attack");
  19.  
  20.         if (AI:GetGroupCount(entity.id) > 1) then    
  21.             AI:Signal(SIGNALID_READIBILITY, AIREADIBILITY_SEEN, "FIRST_HOSTILE_CONTACT_GROUP",entity.id);    
  22.             AI:Signal(SIGNALFILTER_SUPERGROUP, 1, "HEADS_UP_GUYS",entity.id);
  23.             AI:Signal(SIGNALFILTER_SUPERGROUP, 1, "wakeup",entity.id);
  24.         else
  25.             AI:Signal(SIGNALID_READIBILITY, AIREADIBILITY_SEEN, "FIRST_HOSTILE_CONTACT",entity.id);    
  26.         end
  27.  
  28.         local SetAngle = entity.Properties.fJumpAngle;
  29.         entity.Properties.fJumpAngle = 38;
  30.         entity:MutantJump(AIAnchor.MUTANT_JUMP_SMALL,20);
  31.         entity.Properties.fJumpAngle=SetAngle;
  32.         
  33.         -- bellow and howl
  34.         entity:InsertSubpipe(0,"jump_decision");
  35.         entity:InsertSubpipe(0,"DropBeaconAt");
  36.         
  37.     end,
  38.     ---------------------------------------------
  39.     OnEnemyMemory = function( self, entity )
  40.         -- called when the enemy can no longer see its foe, but remembers where it saw it last
  41.     end,
  42.     ---------------------------------------------
  43.     OnInterestingSoundHeard = function( self, entity )
  44.         -- called when the enemy hears an interesting sound
  45.         entity:Readibility("IDLE_TO_INTERESTED");
  46.         entity:SelectPipe(0,"mutant_walk_to_target");
  47.     end,
  48.     ---------------------------------------------
  49.     OnThreateningSoundHeard = function( self, entity )
  50.         -- called when the enemy hears a scary sound
  51.         entity:Readibility("IDLE_TO_THREATENED",1);
  52.         entity:SelectPipe(0,"abberation_attack");
  53.         entity:InsertSubpipe(0,"DropBeaconAt");
  54.     end,
  55.     ---------------------------------------------
  56.     OnReload = function( self, entity )
  57.         -- called when the enemy goes into automatic reload after its clip is empty
  58.     end,
  59.     ---------------------------------------------
  60.     OnGroupMemberDied = function( self, entity )
  61.         -- called when a member of the group dies
  62.     end,
  63.     ---------------------------------------------
  64.     OnNoHidingPlace = function( self, entity, sender )
  65.         -- called when no hiding place can be found with the specified parameters
  66.     end,    
  67.     ---------------------------------------------
  68.     OnReceivingDamage = function ( self, entity, sender)
  69.         -- called when the enemy is damaged
  70.     end,
  71.     --------------------------------------------------
  72.     OnBulletRain = function ( self, entity, sender)
  73.         -- called when the enemy detects bullet trails around him
  74.     end,
  75.     --------------------------------------------------
  76.     MAKE_BELLOW_HOWL_ANIMATION = function ( self, entity, sender)
  77.         entity:InsertAnimationPipe("idle05");
  78.     end,
  79.     --------------------------------------------------
  80.     OnDeath = function ( self, entity, sender)
  81.         -- get someone else to attack the player
  82.         AI:Signal(SIGNALFILTER_NEARESTGROUP,1,"SWITCH_TO_ATTACK",entity.id);
  83.     end,
  84.  
  85.     --------------------------------------------------
  86.     HEADS_UP_GUYS = function ( self, entity, sender)
  87.         if (entity.id ~= sender.id) then
  88.             entity:SelectPipe(0,"run_to_beacon");
  89.             local SetAngle = entity.Properties.fJumpAngle;
  90.             entity.Properties.fJumpAngle = 45;
  91.             entity:MutantJump(AIAnchor.MUTANT_JUMP_SMALL,20);
  92.             entity.Properties.fJumpAngle=SetAngle;
  93.         end
  94.         entity.EventToCall = "OnPlayerSeen";
  95.     end,
  96.  
  97.     MAKE_COMBAT_BREAK_ANIM = function ( self, entity, sender)
  98.         
  99.         if (entity.COMBAT_IDLE_COUNT) then
  100.             local rnd = random(0,entity.COMBAT_IDLE_COUNT);
  101.             local idle_anim_name = format("combat_idle%02d",rnd);
  102.             entity:InsertAnimationPipe(idle_anim_name,3);
  103.         else
  104.             Hud:AddMessage("============ UNACCEPTABLE ERROR ===================");
  105.             Hud:AddMessage("[ASSETERROR] No combat idles for "..entity:GetName());
  106.             Hud:AddMessage("============ UNACCEPTABLE ERROR ===================");
  107.         end
  108.  
  109.     end,
  110.  
  111.     --------------------------------------------------
  112.     SEEK_JUMP_ANCHOR = function ( self, entity, sender)
  113.         local att_target = AI:GetAttentionTargetOf(entity.id);
  114.         if (att_target) then 
  115.             if (type(att_target) == "table") then
  116.                 if (att_target == _localplayer) then 
  117.                     entity:MutantJump(AIOBJECT_PLAYER,10);
  118.                 else
  119.                     entity:MutantJump(AIOBJECT_PUPPET,10);
  120.                 end
  121.             end
  122.         end
  123.     end,
  124.     --------------------------------------------------
  125.     JUMP_FINISHED = function ( self, entity, sender)
  126.         entity:SelectPipe(0,"abberation_attack");
  127.     end,
  128.  
  129.  
  130.     SWITCH_TO_ATTACK = function ( self, entity, sender)
  131.         entity:SelectPipe(0,"abberation_attack");
  132.     end,
  133.  
  134.  
  135.     --------------------------------------------------
  136.     ANY_MORE_TO_RELEASE = function ( self, entity, sender)
  137.         local release_friends = AI:FindObjectOfType(entity.id,50,AIAnchor.MUTANT_LOCK);
  138.         if (release_friends) then 
  139.             entity:SelectPipe(0,"bust_lock_at",release_friends);            
  140.         else
  141.             entity:SelectPipe(0,"abberation_attack");
  142.         end
  143.     end,
  144. }